[−][src]Crate sloggers
This crate provides frequently used slog loggers and convenient functions.
Examples
Creates a logger via TerminalLoggerBuilder
:
use slog::info; use sloggers::Build; use sloggers::terminal::{TerminalLoggerBuilder, Destination}; use sloggers::types::Severity; let mut builder = TerminalLoggerBuilder::new(); builder.level(Severity::Debug); builder.destination(Destination::Stderr); let logger = builder.build().unwrap(); info!(logger, "Hello World!");
Creates a logger from configuration text (TOML):
use slog::info; use sloggers::{Config, LoggerConfig}; let config: LoggerConfig = serdeconv::from_toml_str(r#" type = "terminal" level = "debug" destination = "stderr" "#).unwrap(); let logger = config.build_logger().unwrap(); info!(logger, "Hello World!");
Modules
file | File logger. |
null | Null logger. |
terminal | Terminal logger. |
types | Commonly used types. |
Structs
Error | The error type for this crate. |
Enums
ErrorKind | A list of error kinds. |
LoggerBuilder | Logger builder. |
LoggerConfig | The configuration of |
Traits
Build | This trait allows to build a logger instance. |
Config | Configuration of a logger builder. |
Functions
set_stdlog_logger | Sets the logger for the log records emitted via |
Type Definitions
Result | A specialized |